export const downloadFile = (response: any, fileType?: any) => {
  const downloadElement = document.createElement('a');
  const href = window.URL.createObjectURL(new Blob([response.data]));
  console.log(response,'response')
  const fileName = response.headers??['content-disposition']
    ? response.headers['content-disposition'].split(';')[1].split('=')[1]
    : new Date().getTime() + (fileType || '.xlsx');
  downloadElement.href = href;
  downloadElement.download = decodeURIComponent(fileName); //解码
  document.body.appendChild(downloadElement);
  downloadElement.click();
  document.body.removeChild(downloadElement);
  window.URL.revokeObjectURL(href); //释放掉blob对象
};
